package org.xx.armory.swing.builders;

import org.xx.armory.objectparser.LineInfo;
import org.xx.armory.swing.components.BorderType;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class GridLayoutModel
        extends AbstractLayoutModel {
    private final int margin;
    private final List<ColumnModel> columns;
    private final List<RowModel> rows;

    protected GridLayoutModel(
            LineInfo lineInfo,
            String name,
            boolean visible,
            String title,
            BorderType border,
            int margin,
            Collection<ColumnModel> columns,
            Collection<RowModel> rows
    ) {
        super(lineInfo, name, visible, title, border);
        this.margin = margin;
        this.columns = columns != null ? new ArrayList<>(columns) : Collections.emptyList();
        this.rows = rows != null ? new ArrayList<>(rows) : Collections.emptyList();
    }

    public final int getMargin() {
        return this.margin;
    }

    public final List<ColumnModel> getColumns() {
        return Collections.unmodifiableList(this.columns);
    }

    public final List<RowModel> getRows() {
        return Collections.unmodifiableList(this.rows);
    }
}
